Optimal. Leaf size=189 \[ \frac {8 a^4 (d \tan (e+f x))^{n+1} \, _2F_1(1,n+1;n+2;i \tan (e+f x))}{d f (n+1)}-\frac {2 a^4 \left (2 n^2+11 n+16\right ) (d \tan (e+f x))^{n+1}}{d f (n+1) (n+2) (n+3)}-\frac {2 (n+4) \left (a^4+i a^4 \tan (e+f x)\right ) (d \tan (e+f x))^{n+1}}{d f (n+2) (n+3)}-\frac {\left (a^2+i a^2 \tan (e+f x)\right )^2 (d \tan (e+f x))^{n+1}}{d f (n+3)} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.53, antiderivative size = 189, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, integrand size = 26, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {3556, 3594, 3592, 3537, 12, 64} \[ \frac {8 a^4 (d \tan (e+f x))^{n+1} \, _2F_1(1,n+1;n+2;i \tan (e+f x))}{d f (n+1)}-\frac {2 a^4 \left (2 n^2+11 n+16\right ) (d \tan (e+f x))^{n+1}}{d f (n+1) (n+2) (n+3)}-\frac {\left (a^2+i a^2 \tan (e+f x)\right )^2 (d \tan (e+f x))^{n+1}}{d f (n+3)}-\frac {2 (n+4) \left (a^4+i a^4 \tan (e+f x)\right ) (d \tan (e+f x))^{n+1}}{d f (n+2) (n+3)} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 64
Rule 3537
Rule 3556
Rule 3592
Rule 3594
Rubi steps
\begin {align*} \int (d \tan (e+f x))^n (a+i a \tan (e+f x))^4 \, dx &=-\frac {(d \tan (e+f x))^{1+n} \left (a^2+i a^2 \tan (e+f x)\right )^2}{d f (3+n)}+\frac {a \int (d \tan (e+f x))^n (a+i a \tan (e+f x))^2 (2 a d (2+n)+2 i a d (4+n) \tan (e+f x)) \, dx}{d (3+n)}\\ &=-\frac {(d \tan (e+f x))^{1+n} \left (a^2+i a^2 \tan (e+f x)\right )^2}{d f (3+n)}-\frac {2 (4+n) (d \tan (e+f x))^{1+n} \left (a^4+i a^4 \tan (e+f x)\right )}{d f (2+n) (3+n)}+\frac {a \int (d \tan (e+f x))^n (a+i a \tan (e+f x)) \left (2 a^2 d^2 \left (8+9 n+2 n^2\right )+2 i a^2 d^2 \left (16+11 n+2 n^2\right ) \tan (e+f x)\right ) \, dx}{d^2 (2+n) (3+n)}\\ &=-\frac {2 a^4 \left (16+11 n+2 n^2\right ) (d \tan (e+f x))^{1+n}}{d f (1+n) (2+n) (3+n)}-\frac {(d \tan (e+f x))^{1+n} \left (a^2+i a^2 \tan (e+f x)\right )^2}{d f (3+n)}-\frac {2 (4+n) (d \tan (e+f x))^{1+n} \left (a^4+i a^4 \tan (e+f x)\right )}{d f (2+n) (3+n)}+\frac {a \int (d \tan (e+f x))^n \left (8 a^3 d^2 (2+n) (3+n)+8 i a^3 d^2 (2+n) (3+n) \tan (e+f x)\right ) \, dx}{d^2 (2+n) (3+n)}\\ &=-\frac {2 a^4 \left (16+11 n+2 n^2\right ) (d \tan (e+f x))^{1+n}}{d f (1+n) (2+n) (3+n)}-\frac {(d \tan (e+f x))^{1+n} \left (a^2+i a^2 \tan (e+f x)\right )^2}{d f (3+n)}-\frac {2 (4+n) (d \tan (e+f x))^{1+n} \left (a^4+i a^4 \tan (e+f x)\right )}{d f (2+n) (3+n)}+\frac {\left (64 i a^7 d^2 (2+n) (3+n)\right ) \operatorname {Subst}\left (\int \frac {8^{-n} \left (-\frac {i x}{a^3 d (2+n) (3+n)}\right )^n}{-64 a^6 d^4 (2+n)^2 (3+n)^2+8 a^3 d^2 (2+n) (3+n) x} \, dx,x,8 i a^3 d^2 (2+n) (3+n) \tan (e+f x)\right )}{f}\\ &=-\frac {2 a^4 \left (16+11 n+2 n^2\right ) (d \tan (e+f x))^{1+n}}{d f (1+n) (2+n) (3+n)}-\frac {(d \tan (e+f x))^{1+n} \left (a^2+i a^2 \tan (e+f x)\right )^2}{d f (3+n)}-\frac {2 (4+n) (d \tan (e+f x))^{1+n} \left (a^4+i a^4 \tan (e+f x)\right )}{d f (2+n) (3+n)}+\frac {\left (i 8^{2-n} a^7 d^2 (2+n) (3+n)\right ) \operatorname {Subst}\left (\int \frac {\left (-\frac {i x}{a^3 d (2+n) (3+n)}\right )^n}{-64 a^6 d^4 (2+n)^2 (3+n)^2+8 a^3 d^2 (2+n) (3+n) x} \, dx,x,8 i a^3 d^2 (2+n) (3+n) \tan (e+f x)\right )}{f}\\ &=-\frac {2 a^4 \left (16+11 n+2 n^2\right ) (d \tan (e+f x))^{1+n}}{d f (1+n) (2+n) (3+n)}+\frac {8 a^4 \, _2F_1(1,1+n;2+n;i \tan (e+f x)) (d \tan (e+f x))^{1+n}}{d f (1+n)}-\frac {(d \tan (e+f x))^{1+n} \left (a^2+i a^2 \tan (e+f x)\right )^2}{d f (3+n)}-\frac {2 (4+n) (d \tan (e+f x))^{1+n} \left (a^4+i a^4 \tan (e+f x)\right )}{d f (2+n) (3+n)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 9.94, size = 1065, normalized size = 5.63 \[ \frac {i 2^{3-n} \left (-\frac {i \left (-1+e^{2 i (e+f x)}\right )}{1+e^{2 i (e+f x)}}\right )^n \cos ^4(e+f x) \left (2^n \, _2F_1\left (1,n;n+1;-\frac {-1+e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right )-\left (1+e^{2 i (e+f x)}\right )^n \, _2F_1\left (n,n;n+1;\frac {1}{2} \left (1-e^{2 i (e+f x)}\right )\right )\right ) (d \tan (e+f x))^n (i \tan (e+f x) a+a)^4 \tan ^{-n}(e+f x)}{\left (e^{2 i e}+e^{4 i e}\right ) f n (\cos (f x)+i \sin (f x))^4}-\frac {8 i e^{-4 i e} \left (-1+e^{2 i (e+f x)}\right )^n \left (-\frac {i \left (-1+e^{2 i (e+f x)}\right )}{1+e^{2 i (e+f x)}}\right )^n \left (\frac {-1+e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right )^{-n} \cos ^4(e+f x) \left (-\frac {\left (1+e^{2 i e}\right ) \left (-1+e^{2 i (e+f x)}\right ) \, _2F_1\left (1,n+1;n+2;\frac {1-e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right ) \left (1+e^{2 i (e+f x)}\right )^{-n-1}}{n+1}-\frac {\, _2F_1\left (1,n;n+1;\frac {1-e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right ) \left (1+e^{2 i (e+f x)}\right )^{-n}}{n}+\frac {2^{-n} \, _2F_1\left (n,n;n+1;\frac {1}{2} \left (1-e^{2 i (e+f x)}\right )\right )}{n}\right ) (d \tan (e+f x))^n (i \tan (e+f x) a+a)^4 \tan ^{-n}(e+f x)}{\left (1+e^{2 i e}\right ) f (\cos (f x)+i \sin (f x))^4}+\frac {\cos ^4(e+f x) \left (\frac {(\cos (2 e)+2 i \sin (2 e)-1) (2 i \cos (4 e)+2 \sin (4 e)) \sec ^2(e)}{n+1}+\frac {\sec (e+f x) (2 i \cos (4 e)+2 \sin (4 e)) (-\cos (e-f x)+\cos (e+f x)-2 i \sin (e-f x)+2 i \sin (e+f x)) \sec ^2(e)}{n+1}\right ) (d \tan (e+f x))^n (i \tan (e+f x) a+a)^4}{f (\cos (f x)+i \sin (f x))^4}+\frac {\cos ^4(e+f x) \left (\frac {\sec (e) (\cos (4 e)-i \sin (4 e)) \sin (f x) \sec ^3(e+f x)}{n+3}+\frac {(\cos (4 e)-i \sin (4 e)) \tan (e) \sec ^2(e+f x)}{n+3}+\frac {\sec (e) (2 \cos (4 e)-2 i \sin (4 e)) \sin (f x) \sec (e+f x)}{(n+1) (n+3)}+\frac {(2 \cos (4 e)-2 i \sin (4 e)) \tan (e)}{(n+1) (n+3)}\right ) (d \tan (e+f x))^n (i \tan (e+f x) a+a)^4}{f (\cos (f x)+i \sin (f x))^4}+\frac {\cos ^4(e+f x) \left (\frac {(-2 n+\cos (2 e)-3) (-2 i \cos (4 e)-2 \sin (4 e)) \sec ^2(e)}{(n+1) (n+2)}+\frac {(\cos (e+f x)-\cos (e-f x)) \sec (e+f x) (-2 i \cos (4 e)-2 \sin (4 e)) \sec ^2(e)}{n+1}+\frac {\sec ^2(e+f x) (-4 i \cos (4 e)-4 \sin (4 e))}{n+2}\right ) (d \tan (e+f x))^n (i \tan (e+f x) a+a)^4}{f (\cos (f x)+i \sin (f x))^4} \]
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
fricas [F] time = 0.53, size = 0, normalized size = 0.00 \[ {\rm integral}\left (\frac {16 \, a^{4} \left (\frac {-i \, d e^{\left (2 i \, f x + 2 i \, e\right )} + i \, d}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right )^{n} e^{\left (8 i \, f x + 8 i \, e\right )}}{e^{\left (8 i \, f x + 8 i \, e\right )} + 4 \, e^{\left (6 i \, f x + 6 i \, e\right )} + 6 \, e^{\left (4 i \, f x + 4 i \, e\right )} + 4 \, e^{\left (2 i \, f x + 2 i \, e\right )} + 1}, x\right ) \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{4} \left (d \tan \left (f x + e\right )\right )^{n}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [F] time = 1.13, size = 0, normalized size = 0.00 \[ \int \left (d \tan \left (f x +e \right )\right )^{n} \left (a +i a \tan \left (f x +e \right )\right )^{4}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{4} \left (d \tan \left (f x + e\right )\right )^{n}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [F] time = 0.00, size = -1, normalized size = -0.01 \[ \int {\left (d\,\mathrm {tan}\left (e+f\,x\right )\right )}^n\,{\left (a+a\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^4 \,d x \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ a^{4} \left (\int \left (d \tan {\left (e + f x \right )}\right )^{n}\, dx + \int \left (- 6 \left (d \tan {\left (e + f x \right )}\right )^{n} \tan ^{2}{\left (e + f x \right )}\right )\, dx + \int \left (d \tan {\left (e + f x \right )}\right )^{n} \tan ^{4}{\left (e + f x \right )}\, dx + \int 4 i \left (d \tan {\left (e + f x \right )}\right )^{n} \tan {\left (e + f x \right )}\, dx + \int \left (- 4 i \left (d \tan {\left (e + f x \right )}\right )^{n} \tan ^{3}{\left (e + f x \right )}\right )\, dx\right ) \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________